package com.itheima.text2;

import java.util.ArrayList;
import java.util.Arrays;

public class Demo2 {
    public static void main(String[] args) {
        ArrayList<Student2> list = new ArrayList<>();
        list.add(new Student2("heima001", "张三", "23"));
        list.add(new Student2("heima002", "李四", "24"));
        list.add(new Student2("heima003", "张三", "23"));
        list.add(new Student2("heima001", "张三", "23"));
        list.add(new Student2("heima001", "张三", "23"));
        list.add(new Student2("heima002", "李四", "24"));
        list.add(new Student2("heima001", "张三", "23"));
        list.add(new Student2("heima002", "李四", "24"));
        list.add(new Student2("heima002", "李四", "24"));
        for (int i = 0; i < list.size(); i++) {
            Student2 s = list.get(i);
            for (int j = i + 1; j < list.size(); j++) {
                Student2 s2 = list.get(j);
                if (s.equals(s2)) {
                    list.remove(j--);
                }
            }
        }
        list.forEach(s -> {
            System.out.println(s);
        });
    }
}

